--- a/pjlib-util/build/pjlib_util.vcxproj
+++ b/pjlib-util/build/pjlib_util.vcxproj
@@ -327,7 +327,7 @@
     </Midl>
     <ClCompile>
       <AdditionalIncludeDirectories>../include;../../pjlib/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>PJ_OS_HAS_CHECK_STACK=0;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PrecompiledHeaderOutputFile />
     </ClCompile>
     <Lib>
--- a/pjlib/build/pjlib.vcxproj
+++ b/pjlib/build/pjlib.vcxproj
@@ -327,8 +327,8 @@
       <TargetEnvironment>X64</TargetEnvironment>
     </Midl>
     <ClCompile>
-      <AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>..\..\..\include;../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_WIN32_WINNT=0x0A00;PJ_TERM_HAS_COLOR=0;PJ_OS_HAS_CHECK_STACK=0;WIN32_NATIVE;PJ_HAS_SSL_SOCK;PJ_HAS_TLS_SOCK;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PrecompiledHeaderOutputFile />
     </ClCompile>
   </ItemDefinitionGroup>
@@ -620,6 +620,7 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     </ClCompile>
     <ClCompile Include="..\src\pj\ip_helper_win32.c">
+	  <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(API_Family)'!='WinDesktop'">true</ExcludedFromBuild>
     </ClCompile>
     <ClCompile Include="..\src\pj\ip_helper_generic.c">
@@ -851,6 +852,7 @@
     <ClCompile Include="..\src\pj\sock_select.c" />
     <ClCompile Include="..\src\pj\ssl_sock_common.c" />
     <ClCompile Include="..\src\pj\ssl_sock_dump.c" />
+	<ClCompile Include="..\src\pj\ssl_sock_gtls.c" />
     <ClCompile Include="..\src\pj\ssl_sock_ossl.c" />
     <ClCompile Include="..\src\pj\string.c" />
     <ClCompile Include="..\src\pj\symbols.c">
--- a/pjlib/include/pj/compat/string.h
+++ b/pjlib/include/pj/compat/string.h
@@ -43,7 +43,7 @@
 #   include <stdlib.h>
 #endif
 
-#if defined(_MSC_VER)
+#if defined(PJ_WIN32)
 #   define strcasecmp	_stricmp
 #   define strncasecmp	_strnicmp
 #   define snprintf	_snprintf
--- /dev/null
+++ b/pjlib/include/pj/config_site.h
@@ -0,0 +1,8 @@
+#include "config_site_sample.h"
+
+#undef PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO
+#undef PJMEDIA_AUDIO_DEV_HAS_WMME
+
+#define PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO 0
+#define PJMEDIA_AUDIO_DEV_HAS_WMME 0
+#define PJMEDIA_RESAMPLE_IMP PJMEDIA_RESAMPLE_SPEEX
\ No newline at end of file
--- a/pjlib/src/pj/file_access_win32.c
+++ b/pjlib/src/pj/file_access_win32.c
@@ -79,7 +79,7 @@ static HANDLE WINAPI create_file(LPCTSTR filename, DWORD desired_access,
     return CreateFile2(filename, desired_access, share_mode,
 	creation_disposition, NULL);
 #else
-    return CreateFile(filename, desired_access, share_mode,
+    return CreateFile2(filename, desired_access, share_mode,
 		      security_attributes, creation_disposition,
 		      flags_and_attributes, template_file);
 #endif
--- a/pjlib/src/pj/file_io_win32.c
+++ b/pjlib/src/pj/file_io_win32.c
@@ -129,7 +129,7 @@ PJ_DEF(pj_status_t) pj_file_open( pj_pool_t *pool,
 			dwDesiredAccess, dwShareMode, dwCreationDisposition,
 			NULL);
 #else
-    hFile = CreateFile(PJ_STRING_TO_NATIVE(pathname,
+    hFile = CreateFile2(PJ_STRING_TO_NATIVE(pathname,
 		       wpathname, sizeof(wpathname)),
 		       dwDesiredAccess, dwShareMode, NULL,
 		       dwCreationDisposition, dwFlagsAndAttributes, NULL);
--- a/pjmedia/build/pjmedia.vcxproj
+++ b/pjmedia/build/pjmedia.vcxproj
@@ -325,7 +325,7 @@
     </Midl>
     <ClCompile>
       <AdditionalIncludeDirectories>../include;../../pjlib/include;../../pjlib-util/include;../../pjnath/include;../../third_party/portaudio/include;../../third_party/speex/include;../../third_party/build/srtp;../../third_party/srtp/include;../../third_party/srtp/crypto/include;../../third_party/yuv/include;../../third_party/webrtc/src;../..;$(DXSDK_DIR)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>PJ_OS_HAS_CHECK_STACK=0;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PrecompiledHeaderOutputFile />
     </ClCompile>
   </ItemDefinitionGroup>
--- a/pjnath/build/pjnath.vcxproj
+++ b/pjnath/build/pjnath.vcxproj
@@ -410,7 +410,7 @@
     </Midl>
     <ClCompile>
       <AdditionalIncludeDirectories>../include;../../pjlib/include;../../pjlib-util/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>PJ_OS_HAS_CHECK_STACK=0;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PrecompiledHeaderOutputFile />
     </ClCompile>
   </ItemDefinitionGroup>
--- a/pjsip/build/pjsip_core.vcxproj
+++ b/pjsip/build/pjsip_core.vcxproj
@@ -327,7 +327,7 @@
     </Midl>
     <ClCompile>
       <AdditionalIncludeDirectories>../include;../../pjlib/include;../../pjlib-util/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>PJ_OS_HAS_CHECK_STACK=0;PJ_HAS_SSL_SOCK;_LIB;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PrecompiledHeaderOutputFile />
     </ClCompile>
     <Lib>
--- a/pjsip/build/pjsip_simple.vcxproj
+++ b/pjsip/build/pjsip_simple.vcxproj
@@ -362,7 +362,7 @@
     </Midl>
     <ClCompile>
       <AdditionalIncludeDirectories>../include;../../pjlib-util/include;../../pjlib/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>PJ_OS_HAS_CHECK_STACK=0;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PrecompiledHeaderOutputFile />
     </ClCompile>
     <Lib>
--- a/pjsip/build/pjsip_ua.vcxproj
+++ b/pjsip/build/pjsip_ua.vcxproj
@@ -327,7 +327,7 @@
     </Midl>
     <ClCompile>
       <AdditionalIncludeDirectories>../include;../../pjlib/include;../../pjlib-util/include;../../pjmedia/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>PJ_OS_HAS_CHECK_STACK=0;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PrecompiledHeaderOutputFile />
     </ClCompile>
     <Lib>
--- a/pjsip/build/pjsua2_lib.vcxproj
+++ b/pjsip/build/pjsua2_lib.vcxproj
@@ -364,7 +364,7 @@
     </Midl>
     <ClCompile>
       <AdditionalIncludeDirectories>../include;../../pjmedia/include;../../pjlib-util/include;../../pjlib/include;../../pjnath/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>PJ_OS_HAS_CHECK_STACK=0;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PrecompiledHeaderOutputFile />
     </ClCompile>
     <Lib>
--- a/pjsip/build/pjsua_lib.vcxproj
+++ b/pjsip/build/pjsua_lib.vcxproj
@@ -362,7 +362,7 @@
     </Midl>
     <ClCompile>
       <AdditionalIncludeDirectories>../include;../../pjmedia/include;../../pjlib-util/include;../../pjlib/include;../../pjnath/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>PJ_OS_HAS_CHECK_STACK=0;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PrecompiledHeaderOutputFile />
     </ClCompile>
     <Lib>
--- a/pjsip/src/pjsip/sip_dialog.c
+++ b/pjsip/src/pjsip/sip_dialog.c
@@ -882,7 +882,7 @@ PJ_DEF(void) pjsip_dlg_inc_lock(pjsip_dialog *dlg)
     PJ_LOG(6,(dlg->obj_name, "Entering pjsip_dlg_inc_lock(), sess_count=%d",
 	      dlg->sess_count));
 
-    pj_mutex_lock(dlg->mutex_);
+    pj_mutex_trylock(dlg->mutex_);
     dlg->sess_count++;
 
     PJ_LOG(6,(dlg->obj_name, "Leaving pjsip_dlg_inc_lock(), sess_count=%d",
--- a/pjlib/build/pjlib.vcxproj
+++ b/pjlib/build/pjlib.vcxproj
@@ -617,7 +617,7 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release-Static|x64'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
     </ClCompile>
     <ClCompile Include="..\src\pj\ip_helper_win32.c">
 	  <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
--- a/pjlib/src/pj/os_core_win32.c
+++ b/pjlib/src/pj/os_core_win32.c
@@ -1424,10 +1424,10 @@ PJ_DEF(pj_status_t) pj_event_pulse(pj_event_t *event)
 
     PJ_LOG(6, (event->obj_name, "Pulsing event"));
 
-    if (PulseEvent(event->hEvent))
+    //if (PulseEvent(event->hEvent))
 	return PJ_SUCCESS;
-    else
-	return PJ_RETURN_OS_ERROR(GetLastError());
+    //else
+	//return PJ_RETURN_OS_ERROR(GetLastError());
 #endif
 }
 
-- 
2.10.2.windows.1

